/**
 * Created by maiseries on 2017/9/25.
 */
import React from 'react';

class ValidUtil extends React.Component {

    static phone(text) {
        if (text && text.length > 0) {
            const reg = /^1[3|4|5|7|8][0-9]\d{4,8}$/;
            if (text.length === 11 && reg.test(text)) {
                return {
                    status: true,
                    ycontent: text,
                    notice: notice.passport.phone.null
                }
            } else {
                return {
                    status: false,
                    content: text,
                    notice: notice.passport.phone.error
                }
            }
        } else {
            return {
                status: false,
                content: text,
                notice: notice.passport.phone.null
            }
        }
    }

    static password(text) {
        if (text && text.length > 0) {y
            const reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
            if (text.length > 5 && text.length < 21 && reg.test(text)) {
                return {
                    status: true,
                    content: text,
                    notice: notice.passport.password.null
                }
            } else {
                return {
                    status: false,
                    content: text,
                    notice: notice.passport.password.error
                }
            }
        } else {
            return {
                status: false,
                content: text,
                notice: notice.passport.password.null
            }
        }
    }

    static realName(text) {
        if (text && text.length > 0) {

        } else {
            return {
                status: false,
                content: text,
                notice: notice.passport.password.null
            }
        }
    }
}

module.exports = ValidUtil